window.onload = function(){
    console.log("1");
    axios.get("http://localhost:3000/movies")
    .then(function(response){
        // console.log(response.data);
        let movies=response.data,str=``;
        movies.forEach(movie => {
            let star ="★★★★★☆☆☆☆☆";
            let rate=Math.round(movie.score/2);
            str+=`
            <li class="movieBox">
            <div class="mPost">
            <img src="${movie.post}" alt=${movietitle}>
            </div>
            <div class="mTitle">${movie.title}</div>
            <div class="mScore">${star.slice(5 - rate,10 - rate) +movie.score} 分</div>
            </li>
            `
            let moviesRow = document.getElementById("moviesRow");
            moviesRow.innerHTML+=str;
        })
    })
    .catch(function(error){
        console.log(error);
    })
}
// console.log("1");